<?php
//dezend by http://www.yunlu99.com/ QQ:270656184
defined('BASEPATH') || exit('No direct script access allowed');
$this->load->helper('url');
?><!DOCTYPE>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="/ui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="/ui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="/static/plugin/font-awesome/css/font-awesome.min.css">


<script language="javascript" src="/ui/jquery.min.js"></script>
<script language="javascript" src="/ui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="/ui/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="/ui/extend/validtype.js"></script>
<style type="text/css">
body{background:#eee;}
</style>
</head>
<body>
<div style="width:400px;margin:100px auto;">
	<div class="easyui-panel" title="管理员登录" style="padding:30px 0px;">
		<div style="padding:10px 60px 20px 60px">
		
		
<?php
if ($logined == 0) {
?>	    <form id="ff" class="easyui-form" method="post" data-options="validate:true">
	    	<p>
<?php
	if (isset($error)) {
?><?php echo $error;?><?php
	}

?></p>
	    	<table cellpadding="5">
	    		<tr>
	    			<td>帐号:</td>
	    			<td><input class="easyui-textbox" type="text" name="username" data-options="required:true"></input></td>
	    		</tr>
	    		<tr>
	    			<td>密码:</td>
	    			<td><input class="easyui-textbox" type="password" name="password" data-options="required:true,validType:'password'"></input></td>
	    		</tr>
	    	</table>
	    
		    <div style="text-align:center;padding:5px">
		    	<button type="submit" iconCls="icon-ok" class="easyui-linkbutton">登录</button>
		    	<a href="javascript:void(0)" iconCls="icon-clear" class="easyui-linkbutton" onclick="clearForm()">清空</a>
		    </div>
	    </form>
	    <?php
}
else {
?>	    <table cellpadding="5">
    		<tr>
    			<td width=75>当前登录:</td>
    			<td><?php echo $user['username'];?></td>
    		</tr>
    		<tr>
    			<td colspan=2><a href="<?php echo site_url('home');?>" class="easyui-linkbutton"><i class="fa fa-home fa-lg"></i> 进入管理平台</a> <a href="<?php echo site_url('login/log_out');?>" iconCls="icon-clear" class="easyui-linkbutton">[退出]</a></td>
    		</tr>
    	</table>
	    <?php
}

?>	    </div>
	</div>
</div>
<script>
$(function(){
	$('#ff').form({
		url:'<?php echo site_url('login/verify');?>',
		onSubmit:function(){
			return $(this).form('validate');
		},
		success:function(data){
			data = eval('('+data+')');
			
			if(data.error == 0){
				window.location.reload();
			}else{
				$.messager.alert('信息提示',data.msg,'info');
			}
		}
	});
	check();
});
function clearForm(){
	$('#ff').form('clear');
}
 
function check(){ 
    if (window.top!=window.self) { 
    	window.top.reload();
    } 
} 
</script> 

</body>
</html>